package com.zty.xiaomi.server.Controller;

import com.zty.xiaomi.server.Entity.User;
import com.zty.xiaomi.server.Service.User.UserService;
import com.zty.xiaomi.server.Vo.UserResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin
@RestController
@RequestMapping("user")
public class UserCenterController {

    @Autowired
    private UserService userService;

    @RequestMapping("getUserInfo")
    public UserResult getUserInfo(@RequestParam("name") String name) {
        User user = userService.getUserInfoByName(name);
        return new UserResult(200, "返回用户信息成功", user);
    }

}
